home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15422 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  55 lines

  1. Path: newshost.cyberramp.net!news
  2. From: sinan@cyberramp.net (John L. Noland)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: PUBLIC / PRIVATE
  5. Date: 18 Apr 1996 23:05:09 GMT
  6. Organization: Uno mas por favor
  7. Message-ID: <4l6hr5$t5o@newshost.cyberramp.net>
  8. References: <4l3k8d$hkp@mulga.cs.mu.OZ.AU>
  9. NNTP-Posting-Host: ramp1-6.cyberramp.net
  10. X-Newsreader: WinVN 0.99.5
  11.  
  12. In article <4l3k8d$hkp@mulga.cs.mu.OZ.AU>, simc@mundil.cs.mu.OZ.AU says...
  13. >
  14. >I'm analysing some C source code and I've
  15. >come across PUBLIC and PRIVATE keywords
  16.  
  17. >I though C didn't have PUBLIC or PRIVATE ?
  18. >It definitely doesn't look like C++ source code - it looks like
  19. >C code with PUBLIC and PRIVATE keywords scattered everywhere.
  20.  
  21. A common C coding style is to give macros names in all caps.
  22. This looks like the case here. I've seen this before. Usually, you'll
  23. have something like this in a header file:
  24.  
  25. #ifdef     DEBUG
  26. #define    PRIVATE
  27. #else      
  28. #define    PRIVATE static
  29. #endif
  30. #define    PUBLIC
  31.  
  32. The first definition of PRIVATE expands to an empty string. This 
  33. lets you put normally invisible variables and subroutines into the
  34. link map. That way you can find them when you're debugging. Then
  35. when you're done debugging their scope is limited to the current
  36. file. PUBLIC doesn't do anything. It's usually provided for documentation
  37. purposes only.
  38.  
  39.  
  40. >2nd question:
  41. >   PRIVATE void HTFWriter_write ARGS3(HTSteam, *, me, CONST char*,
  42. >                                        s, int, l) { fwrite(s, 1, l, me->fp) }
  43. >
  44. >   What is the ARGS3 ?
  45. >   I'm accustomed to 
  46. >        return_type function_name(args) { ... }
  47. >
  48.  
  49. It's probably a macro also, though I'm not sure what it does. Look
  50. in the #include files for this file. You'll probably find #define's
  51. for these in one of them.
  52.  
  53. -John
  54.  
  55.